package org.thanos.demo.service.user;

import org.apache.shiro.lang.util.Assert;
import org.springframework.stereotype.Service;
import org.thanos.demo.entity.SysUserRole;

import java.util.Objects;

@Service("sysUserRoleService")
public class SysUserRoleServiceImpl implements SysUserRoleService {

    @Override
    public SysUserRole selectByUserId(Integer userId) {
        Assert.isTrue(Objects.nonNull(userId));
        return SysUserRole.data().stream().filter(sysUserRole -> sysUserRole.getUserId().equals(userId)).findAny().orElse(null);
    }
}
